cmake_minimum_required(VERSION 3.4.1)
set(SRC_DIR src/main/jni)
include_directories(src/main/jni)
aux_source_directory(src/main/jni SRC_LIST)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/jniLibs/${ANDROID_ABI})

#aux_source_directory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/common src_amr_nb_common)

#aux_source_directory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/des src_amr_nb_dec)
#aux_source_directory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc src_amr_nb_nec)

#aux_source_directory(src/main/jni/oscl oscl_src)

add_subdirectory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/common)
add_subdirectory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec)
add_subdirectory(src/main/jni/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc)


add_library(amr-codec SHARED src/main/jni/amr_decoder.cpp  ${SRC_LIST})
#add_library(amr-codec SHARED src/main/cpp/amr_encoder.cpp  )
#add_library(wrapper SHARED src/main/cpp/wrapper.cpp ${SRC_LIST})

find_library(log-lib log)

target_link_libraries(amr-codec ${log-lib})

#=======
#
#LOCAL_PATH := $(call my-dir)
#include $(CLEAR_VARS)
#
#PV_TOP := $(LOCAL_PATH)/opencore
#PV_INCLUDES := $(LOCAL_PATH)/oscl \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/include \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/src \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/include \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/src \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/include \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/src \
#					$(PV_TOP)/codecs_v2/audio/gsm_amr/common/dec/include
#
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/dec/Android.mk
#include $(PV_TOP)/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
#
#include $(CLEAR_VARS)
#
#LOCAL_PATH := $(PV_TOP)/..
#LOCAL_MODULE := amr-codec
#LOCAL_SRC_FILES := $(LOCAL_PATH)/amr_encoder.cpp \
#				$(LOCAL_PATH)/amr_decoder.cpp \
#				$(LOCAL_PATH)/wrapper.cpp
#
#LOCAL_C_INCLUDES := $(PV_INCLUDES)
#
#
#LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
#LOCAL_SHARED_LIBRARIES := libpv_amr_nb_common_lib \
#						libpvencoder_gsmamr \
#						libpvdecoder_gsmamr
#
#
#include $(BUILD_SHARED_LIBRARY)
